let aLi = document.querySelectorAll('#wrap ul li');
let aBgbox = document.querySelectorAll('.bgbox');

let lastLi = aLi[3];
let lastBgbox = aBgbox[3];
lastBgbox.style['opacity'] = 1;

for(let i=0,li;li = aLi[i];i++){
    li.addEventListener('mouseenter',function(){
        if(lastLi == this ) return;
        this.style.width= '789px';
        aBgbox[i].style['opacity'] = 1;

        lastLi.style.width= '100px';
        lastBgbox.style['opacity'] = 0;

        lastLi = this;
        lastBgbox=aBgbox[i];
    })
   
}

